#include <bits/stdc++.h>

using namespace std;

int main() {
    double a, b;
    cin >> a >> b;
    double sqrt_a = sqrt(a);
    double result = sqrt(b * b + (sqrt_a + 1) * (sqrt_a + 1));
    cout << fixed << setprecision(6) << result << endl;
    return 0;
}